package com.liwalla.domain;

import com.liwalla.domain.GrowthDataOnDemand;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;

privileged aspect GrowthIntegrationTest_Roo_IntegrationTest {
    
    declare @type: GrowthIntegrationTest: @RunWith(SpringJUnit4ClassRunner.class);
    
    declare @type: GrowthIntegrationTest: @ContextConfiguration(locations = "classpath:/META-INF/spring/applicationContext.xml");
    
    @Autowired
    private GrowthDataOnDemand GrowthIntegrationTest.dod;
    
    @Test
    public void GrowthIntegrationTest.testCountGrowths() {
        org.junit.Assert.assertNotNull("Data on demand for 'Growth' failed to initialize correctly", dod.getRandomGrowth());
        long count = com.liwalla.domain.Growth.countGrowths();
        org.junit.Assert.assertTrue("Counter for 'Growth' incorrectly reported there were no entries", count > 0);
    }
    
    @Test
    public void GrowthIntegrationTest.testFindGrowth() {
        org.junit.Assert.assertNotNull("Data on demand for 'Growth' failed to initialize correctly", dod.getRandomGrowth());
        java.util.Date id = dod.getRandomGrowth().getDate();
        org.junit.Assert.assertNotNull("Data on demand for 'Growth' failed to provide an identifier", id);
        com.liwalla.domain.Growth obj = com.liwalla.domain.Growth.findGrowth(id);
        org.junit.Assert.assertNotNull("Find method for 'Growth' illegally returned null for id '" + id + "'", obj);
        org.junit.Assert.assertEquals("Find method for 'Growth' returned the incorrect identifier", id, obj.getDate());
    }
    
    @Test
    public void GrowthIntegrationTest.testFindAllGrowths() {
        org.junit.Assert.assertNotNull("Data on demand for 'Growth' failed to initialize correctly", dod.getRandomGrowth());
        long count = com.liwalla.domain.Growth.countGrowths();
        org.junit.Assert.assertTrue("Too expensive to perform a find all test for 'Growth', as there are " + count + " entries; set the findAllMaximum to exceed this value or set findAll=false on the integration test annotation to disable the test", count < 250);
        java.util.List<com.liwalla.domain.Growth> result = com.liwalla.domain.Growth.findAllGrowths();
        org.junit.Assert.assertNotNull("Find all method for 'Growth' illegally returned null", result);
        org.junit.Assert.assertTrue("Find all method for 'Growth' failed to return any data", result.size() > 0);
    }
    
    @Test
    public void GrowthIntegrationTest.testFindGrowthEntries() {
        org.junit.Assert.assertNotNull("Data on demand for 'Growth' failed to initialize correctly", dod.getRandomGrowth());
        long count = com.liwalla.domain.Growth.countGrowths();
        if (count > 20) count = 20;
        java.util.List<com.liwalla.domain.Growth> result = com.liwalla.domain.Growth.findGrowthEntries(0, (int)count);
        org.junit.Assert.assertNotNull("Find entries method for 'Growth' illegally returned null", result);
        org.junit.Assert.assertEquals("Find entries method for 'Growth' returned an incorrect number of entries", count, result.size());
    }
    
    @Test
    @Transactional
    public void GrowthIntegrationTest.testFlush() {
        org.junit.Assert.assertNotNull("Data on demand for 'Growth' failed to initialize correctly", dod.getRandomGrowth());
        java.util.Date id = dod.getRandomGrowth().getDate();
        org.junit.Assert.assertNotNull("Data on demand for 'Growth' failed to provide an identifier", id);
        com.liwalla.domain.Growth obj = com.liwalla.domain.Growth.findGrowth(id);
        org.junit.Assert.assertNotNull("Find method for 'Growth' illegally returned null for id '" + id + "'", obj);
        boolean modified =  dod.modifyGrowth(obj);
        java.lang.Integer currentVersion = obj.getVersion();
        obj.flush();
        org.junit.Assert.assertTrue("Version for 'Growth' failed to increment on flush directive", obj.getVersion() > currentVersion || !modified);
    }
    
    @Test
    @Transactional
    public void GrowthIntegrationTest.testMerge() {
        org.junit.Assert.assertNotNull("Data on demand for 'Growth' failed to initialize correctly", dod.getRandomGrowth());
        java.util.Date id = dod.getRandomGrowth().getDate();
        org.junit.Assert.assertNotNull("Data on demand for 'Growth' failed to provide an identifier", id);
        com.liwalla.domain.Growth obj = com.liwalla.domain.Growth.findGrowth(id);
        org.junit.Assert.assertNotNull("Find method for 'Growth' illegally returned null for id '" + id + "'", obj);
        boolean modified =  dod.modifyGrowth(obj);
        java.lang.Integer currentVersion = obj.getVersion();
        obj.merge();
        obj.flush();
        org.junit.Assert.assertTrue("Version for 'Growth' failed to increment on merge and flush directive", obj.getVersion() > currentVersion || !modified);
    }
    
    @Test
    @Transactional
    public void GrowthIntegrationTest.testPersist() {
        org.junit.Assert.assertNotNull("Data on demand for 'Growth' failed to initialize correctly", dod.getRandomGrowth());
        com.liwalla.domain.Growth obj = dod.getNewTransientGrowth(Integer.MAX_VALUE);
        org.junit.Assert.assertNotNull("Data on demand for 'Growth' failed to provide a new transient entity", obj);
        org.junit.Assert.assertNull("Expected 'Growth' identifier to be null", obj.getDate());
        obj.persist();
        obj.flush();
        org.junit.Assert.assertNotNull("Expected 'Growth' identifier to no longer be null", obj.getDate());
    }
    
    @Test
    @Transactional
    public void GrowthIntegrationTest.testRemove() {
        org.junit.Assert.assertNotNull("Data on demand for 'Growth' failed to initialize correctly", dod.getRandomGrowth());
        java.util.Date id = dod.getRandomGrowth().getDate();
        org.junit.Assert.assertNotNull("Data on demand for 'Growth' failed to provide an identifier", id);
        com.liwalla.domain.Growth obj = com.liwalla.domain.Growth.findGrowth(id);
        org.junit.Assert.assertNotNull("Find method for 'Growth' illegally returned null for id '" + id + "'", obj);
        obj.remove();
        obj.flush();
        org.junit.Assert.assertNull("Failed to remove 'Growth' with identifier '" + id + "'", com.liwalla.domain.Growth.findGrowth(id));
    }
    
}
